Take window groups into account. (#309473, Diego Gonzalez)
authorMatthias Clasen <mclasen@redhat.com>
Tue, 5 Jul 2005 22:34:07 +0000 (22:34 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 5 Jul 2005 22:34:07 +0000 (22:34 +0000)
2005-07-05  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkmenu.c (gtk_menu_grab_notify): Take window
        groups into account.  (#309473, Diego Gonzalez)

        * gtk/gtkwindow.[hc]: Add a non-exported function to
        get the grab widget of a window group.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
docs/reference/gtk/tmpl/gtkmain.sgml
gtk/gtkmenu.c
gtk/gtkwindow.c
gtk/gtkwindow.h

index f27ec5403f3389359a2b99f8b7f242b5b6697d19..a42045ecd1cd7bcac5718c081e82b5d2a4a794f0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-05  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkmenu.c (gtk_menu_grab_notify): Take window
+       groups into account.  (#309473, Diego Gonzalez)
+
+       * gtk/gtkwindow.[hc]: Add a non-exported function to
+       get the grab widget of a window group.
+
 2005-07-05  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_bin_expose): in the
index f27ec5403f3389359a2b99f8b7f242b5b6697d19..a42045ecd1cd7bcac5718c081e82b5d2a4a794f0 100644 (file)
@@ -1,3 +1,11 @@
+2005-07-05  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkmenu.c (gtk_menu_grab_notify): Take window
+       groups into account.  (#309473, Diego Gonzalez)
+
+       * gtk/gtkwindow.[hc]: Add a non-exported function to
+       get the grab widget of a window group.
+
 2005-07-05  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_bin_expose): in the
index f27ec5403f3389359a2b99f8b7f242b5b6697d19..a42045ecd1cd7bcac5718c081e82b5d2a4a794f0 100644 (file)
@@ -1,3 +1,11 @@
+2005-07-05  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkmenu.c (gtk_menu_grab_notify): Take window
+       groups into account.  (#309473, Diego Gonzalez)
+
+       * gtk/gtkwindow.[hc]: Add a non-exported function to
+       get the grab widget of a window group.
+
 2005-07-05  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_bin_expose): in the
index ce4d115cca51381626a0667752e19e57d27f7d94..c45bf6cca575d2e36666f60eb2ef70bebe7c461b 100644 (file)
@@ -387,7 +387,7 @@ keyboard events are delivered to this widget.
 
 <!-- ##### FUNCTION gtk_grab_get_current ##### -->
 <para>
-Queries the current grab. 
+Queries the current grab of the default window group
 </para>
 
 @Returns: The widget which currently has the grab or %NULL if no grab is active.
index 4096511b9db966192b9c35a2a64ec318a0d8ef0b..de23fe7f66d51c04e2917b1875d76abbcd08416c 100644 (file)
@@ -4387,8 +4387,7 @@ gtk_menu_set_monitor (GtkMenu *menu,
 /**
  * gtk_menu_get_for_attach_widget:
  * @widget: a #GtkWidget
- *
- * Returns a list of the menus which are attached to this widget.
+ * * Returns a list of the menus which are attached to this widget.
  * This list is owned by GTK+ and must not be modified.
  *
  * Return value: the list of menus attached to his widget.
@@ -4410,10 +4409,18 @@ static void
 gtk_menu_grab_notify (GtkWidget *widget,
                      gboolean   was_grabbed)
 {
+  GtkWidget *toplevel;
+  GtkWindowGroup *group;
+  GtkWidget *grab;
+
+  toplevel = gtk_widget_get_toplevel (widget);
+  group = _gtk_window_get_group (GTK_WINDOW (toplevel));
+  grab = _gtk_window_group_get_current_grab (group); 
+
   if (!was_grabbed)
     {
-      if (!GTK_IS_MENU (gtk_grab_get_current ()))
-       gtk_menu_shell_cancel (GTK_MENU_SHELL (widget));
+      if (!GTK_IS_MENU_SHELL (grab))
+        gtk_menu_shell_cancel (GTK_MENU_SHELL (widget));
     }
 }
 
index 47f560180566eb6660d186818cda5381b7aa7359..9811973344cf658fdec4385263eaadf02dc93cae 100644 (file)
@@ -6943,6 +6943,15 @@ _gtk_window_get_group (GtkWindow *window)
     }
 }
 
+/* Return the current grab widget of the given group 
+ */
+GtkWidget *
+_gtk_window_group_get_current_grab (GtkWindowGroup *window_group)
+{
+  if (window_group->grabs)
+    return GTK_WIDGET (window_group->grabs->data);
+  return NULL;
+}
 
 /*
   Derived from XParseGeometry() in XFree86  
index a9871e59bf18f94546e3659b34e42205eeecc2cc..6d60912c027feb035bafad656e593fe9cf1ec3fb 100644 (file)
@@ -391,6 +391,7 @@ void            _gtk_window_constrain_size     (GtkWindow *window,
                                                gint      *new_width,
                                                gint      *new_height);
 GtkWindowGroup *_gtk_window_get_group          (GtkWindow *window);
+GtkWidget      *_gtk_window_group_get_current_grab (GtkWindowGroup *window_group);
 
 void            _gtk_window_set_has_toplevel_focus (GtkWindow *window,
                                                    gboolean   has_toplevel_focus);